﻿using System.Collections.Generic;
using System.Linq;
using System.Reflection;

namespace Borg
{
    public class PluginEventArgs : SystemEventArgs
    {
        internal readonly PluginInfo pluginInfo;

        public PluginInfo PluginInfo
        {
            get { return pluginInfo; }
        }

        public RepositoryCollection<ExtensionTypeInfo> ExtensionTypeInfos
        {
            get { return pluginInfo.extensionTypeInfos; }
        }

        public IEnumerable<ExtensionInfo> ExtensionInfos
        {
            get { return pluginInfo.extensionTypeInfos.SelectMany(eti => eti.ExtensionInfos); }
        }

        public PluginEventArgs(PluginInfo pluginInfo, Assembly initiator)
            : base(initiator)
        {
            this.pluginInfo = pluginInfo;
        }
    }

    public delegate void PluginEventHandler(object sender, PluginEventArgs args);
}

